define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
    return {
        index: function () {
            Table.api.init({
                extend: {
                    index_url: 'zzcash/out/index' + location.search,
                    table    : 'zzcash_out',
                }
            })
            var table = $("#table")
            table.bootstrapTable({
                url     : $.fn.bootstrapTable.defaults.extend.index_url,
                pk      : 'id',
                sortName: 'id',
                columns : [
                    [
                        {checkbox: true},
                        {field: 'id', title: 'id'},
                        {field: 'admin.nickname', title: '操作员', formatter: Table.api.formatter.search},
                        {field: 'user.nickname', title: '用户', formatter: Table.api.formatter.search},
                        {field: 'money', title: '提现金额', operate: 'between'},
                        {field: 'payed_is', title: '是否已支付', searchList: Config.payed_is_map, formatter: Table.api.formatter.label},
                        {field: 'create_at', title: '创建时间', operate: 'range', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
                        {
                            field    : 'operate', title: '操作', table: table,
                            events   : Table.api.events.operate,
                            formatter: Table.api.formatter.operate,
                            buttons  : [
                                {
                                    text     : '打款',
                                    classname: 'btn btn-info btn-ajax',
                                    url      : 'zzcash/out/do',
                                    confirm  : '确定?',
                                    refresh  : true,
                                },
                            ],
                        },
                    ]
                ]
            });
            Table.api.bindevent(table)
        },
        add  : function () {
            Form.api.bindevent($("form[role=form]"))
        },
        edit : function () {
            Form.api.bindevent($("form[role=form]"))
        }
    }
})
